package routers

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type Res struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func DefaultRouter(r *gin.Engine) {
	router := r.Group("/")
	router.GET("", func(c *gin.Context) {
		c.String(http.StatusOK, "hello %v", "陈浩杰")
	})

	router.GET("ping1", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"code": 0,
			"msg":  "success",
		})
	})

	router.GET("ping2", func(c *gin.Context) {
		c.JSON(http.StatusOK, Res{
			Code: 0,
			Msg:  "success",
		})
	})
}
